#include "stdafx.h"
using namespace std;
uint uiInterval, uiMachineCount=0;
char** Clients;
char** Machines;
int * nClientId;
int * nMachineIds;

int _tmain(int argc, _TCHAR* argv[])
{
	MFile config;
	config.Open("config.bin");
	fseek(config.GetFile(),0,S_END);
	uint uiMaxSize=ftell(config.GetFile());
	fseek(config.GetFile(),0,S_BEGIN);
	while(ftell(config.GetFile())<uiMaxSize)
	{
		config.GoToNextBlock();
		uiMachineCount++;
	}
	fseek(config.GetFile(),0,S_BEGIN);
	Clients=new char*[uiMachineCount];
	nClientId=new int[uiMachineCount];
	nMachineIds=new int[uiMachineCount];
	Machines=new char*[uiMachineCount];
	for (int i=0; i<uiMachineCount; i++)
	{
		Clients[i]=new char[256];
		Machines[i]=new char[256];
	}
	for (int i=0; ftell(config.GetFile())<uiMaxSize; i++)
	{
		uint tmp=config.GetID();
		if (tmp==0)
		{
			config.GetURL(Clients[i]);
			nClientId[i]=config.GetID();
			config.GoToNextBlock();
		} else
		{
			config.GetURL(Machines[i]);
			nMachineIds[i]=config.GetID();
			config.GoToNextBlock();
		}
	}
	getch();


/*	TCPMan	ManagerTCP(ChatClientFabric, ChatServerFabric);
	if(!(ManagerTCP.IsWork()))
	{
		std::cout<<"Error: Cant create TCPManager\n";
		return -1;
	}
	mgr=&ManagerTCP;
	ManagerTCP.CreateServer(80);
	CreateThread(0,0,(LPTHREAD_START_ROUTINE)UpdateThread,0,0,0);
	bUpdate=0;
	Sleep(50);*/
	return 0;
}

